/**
 * FileName: answer_1
 * Author:   why
 * Date:     2019/3/12 17:46
 * Description:暴力法
 */
package algorithm.leetcode.problem_1;

public class answer_1 {
    public static int[] twoSum(int[] nums, int target) {
        //双层循环
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[j] == target - nums[i]) {
                    return new int[]{i, j};
                }
            }
        }
        throw new IllegalArgumentException("no answer_2 sum solution");
    }
}
